package org.fing.edu.uy.admin.managedBean;


import java.io.Serializable;
import java.util.List;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

import org.fing.edu.uy.admin.factory.ManagerFactory;
import org.fing.edu.uy.admin.utils.FacesUtils;
import org.fing.edu.uy.esbadp.core.entity.DMAdpMonitorProperty;

@ViewScoped
@ManagedBean(name="esbAdpMonitorPropertiesController")
public class EsbAdpMonitorPropertiesController implements Serializable {
 

	/**
	 * 
	 */
	private static final long serialVersionUID = 4981779370413952870L;
	private List<DMAdpMonitorProperty> req;


	public EsbAdpMonitorPropertiesController() {
    	
    }

    @PostConstruct
    public void init(){
        try {
        	req = ManagerFactory.getEsbAdpManager().getAdpMonitorProperties().getProperties();	        	
		} catch (Exception e) {
			e.printStackTrace();
		}           
    }
    
    
    public void reloadProperties(){
    	try {
			ManagerFactory.getEsbAdpManager().reloadAdpMonitorProperties();
			req = ManagerFactory.getEsbAdpManager().getAdpMonitorProperties().getProperties();	        	
		} catch (Exception e) {
			FacesUtils.addSev("Error reloading adp service requirements");
			e.printStackTrace();
		}
    }

	public List<DMAdpMonitorProperty> getReq() {
		return req;
	}

	public void setReq(List<DMAdpMonitorProperty> req) {
		this.req = req;
	}

	
    
}
